<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>New Literal Pattern Requests</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'New Literal Pattern Requests' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../inform7n.html">Inform7</a></li><li><a href="index.html">assertions</a></li><li><a href="index.html#3">Chapter 3: Requests</a></li><li><b>New Literal Pattern Requests</b></li></ul></div>
<p class="purpose">Special sentences creating new notations for literal values.</p>

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. </b>The ability to create new ways to write literal values is one of the best
features of Inform, but it is complex to parse, and has around 30 problem
messages associated with it. The <span class="extract"><span class="extract-syntax">:literals</span></span> set of test cases may be useful
when tweaking the code below.
</p>

<p class="commentary">The first point to note is that "X specifies Y" sentences have two different
uses, but that both are covered below. First, they create literal patterns,
and the syntax for that can be quite involved:
</p>

<blockquote>
    <p>1 tonne (in metric units, in tonnes, singular) specifies a mass scaled up by 1000.</p>
</blockquote>

<p class="commentary">Second, they can gives dimensional instructions about kinds:
</p>

<blockquote>
    <p>A length times a length specifies an area.</p>
</blockquote>

<p class="commentary">This is a slightly unhappy ambiguity, but the potential for confusion is low.
Nobody who defines a literal pattern with the word "times" in can expect good
results anyway, given that "times" will usually be interpreted as
multiplication when Inform eventually parses such a literal.
</p>

<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>We create new literal patterns during pass 1, which imposes two timing
constraints:
</p>

<ul class="items"><li>(a) The specification sentence must come after the sentence creating the
kind of value being specified; but
</li><li>(b) It must come before any sentences using constants written in this
notation.
</li></ul>
<p class="commentary">In practice both constraints seem to be accepted by users as reasonable,
and this causes no trouble.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">LPRequests::specifies_SMF</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">LPRequests::specifies_SMF</span></span>:<br/>Booting Verbs - <a href="2-bv.html#SP1_1">&#167;1.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">task</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">V</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> *</span><span class="identifier-syntax">NPs</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">SW</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">NPs</span><span class="plain-syntax">)?(</span><span class="identifier-syntax">NPs</span><span class="plain-syntax">[0]):</span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">OW</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">NPs</span><span class="plain-syntax">)?(</span><span class="identifier-syntax">NPs</span><span class="plain-syntax">[1]):</span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">task</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">ACCEPT_SMFT:</span><span class="plain-syntax"> </span><span class="comment-syntax"> "10'23 specifies a running time."</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;np-alternative-list&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">SW</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;rp&gt;&gt;</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;np-unparsed&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">O</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;rp&gt;&gt;</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">V</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next</span><span class="plain-syntax"> = </span><span class="identifier-syntax">S</span><span class="plain-syntax">; </span><span class="identifier-syntax">V</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next</span><span class="plain-syntax"> = </span><span class="identifier-syntax">O</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">PASS_1_SMFT:</span>
<span class="plain-syntax">            </span><a href="3-nlpr.html#SP4" class="function-link"><span class="function-syntax">LPRequests::new_list</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">V</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next</span><span class="plain-syntax">, </span><span class="identifier-syntax">V</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>The code in this section parses sentences which set up new literal patterns,
puts the (quite complicated) result into a <a href="3-nlpr.html#SP3" class="internal">lp_specification</a> object, and
sends that to <a href="../values-module/3-lp.html" class="internal">Literal Patterns (in values)</a>.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">SINGULAR_LPN</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">PLURAL_LPN</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">ABANDON_LPN</span><span class="plain-syntax"> </span><span class="constant-syntax">4</span><span class="plain-syntax"> </span><span class="comment-syntax"> for error recovery only</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">lp_specification</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">notation_wording</span><span class="plain-syntax">; </span><span class="comment-syntax"> the actual notation, e.g., "2 tonnes"</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">kind_specified</span><span class="plain-syntax">; </span><span class="comment-syntax"> what kind this sentence specifies</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">scaled_dir</span><span class="plain-syntax">; </span><span class="comment-syntax"> one of the </span><span class="extract"><span class="extract-syntax">LP_SCALED_*</span></span><span class="comment-syntax"> constants above</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">scale_factor</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">double</span><span class="plain-syntax"> </span><span class="identifier-syntax">scale_factor_as_double</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">equivalent_value</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">double</span><span class="plain-syntax"> </span><span class="identifier-syntax">equivalent_value_as_double</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">offset_value</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">double</span><span class="plain-syntax"> </span><span class="identifier-syntax">offset_value_as_double</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">number_base</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">uses_real_arithmetic</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">notation_options</span><span class="plain-syntax">; </span><span class="comment-syntax"> a bitmap of the </span><span class="extract"><span class="extract-syntax">*_LPN</span></span><span class="comment-syntax"> values</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">literal_pattern_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">notation_groups</span><span class="plain-syntax">; </span><span class="comment-syntax"> "in metric units", and so on</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">part_np_list</span><span class="plain-syntax">;</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">lp_specification</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">lp_specification</span><span class="plain-syntax"> </span><span class="identifier-syntax">glps</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">LPRequests::initialise</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">LPRequests::initialise</span></span>:<br/><a href="3-nlpr.html#SP4">&#167;4</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">lp_specification</span><span class="plain-syntax"> *</span><span class="identifier-syntax">lps</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lps</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">scaled_dir</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LP_SCALED_UP</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lps</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">scale_factor</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lps</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">scale_factor_as_double</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">.0;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lps</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">equivalent_value_as_double</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">.0;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lps</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">equivalent_value</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lps</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">offset_value_as_double</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">.0;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lps</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">offset_value</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lps</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">number_base</span><span class="plain-syntax"> = </span><span class="constant-syntax">10</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lps</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">uses_real_arithmetic</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lps</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">notation_options</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lps</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">notation_groups</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lps</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">notation_wording</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">lps</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">part_np_list</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>The structure lp_specification is private to this section.</li></ul>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b>One can define LPs with a list of alternatives, of which the first is the
"primary alternative" and said to be the "owner" of the rest. For instance:
</p>

<blockquote>
    <p>1 tonne (in metric units, in tonnes, singular) or 2 tonnes (in metric units,</p>
</blockquote>

<p class="commentary">in tonnes, plural) specifies a mass scale_factor up by 1000.
</p>

<p class="commentary">Here "1 tonne" is the primary alternative, and it owns "2 tonnes".
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">literal_pattern</span><span class="plain-syntax"> *</span><span class="function-syntax">LPRequests::new_list</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">LPRequests::new_list</span></span>:<br/><a href="3-nlpr.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">p</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">q</span><span class="plain-syntax">, </span><span class="identifier-syntax">literal_pattern</span><span class="plain-syntax"> *</span><span class="identifier-syntax">m</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Node::get_type</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">) == </span><span class="identifier-syntax">AND_NT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">m</span><span class="plain-syntax"> = </span><a href="3-nlpr.html#SP4" class="function-link"><span class="function-syntax">LPRequests::new_list</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">, </span><span class="identifier-syntax">q</span><span class="plain-syntax">, </span><span class="identifier-syntax">m</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-nlpr.html#SP4" class="function-link"><span class="function-syntax">LPRequests::new_list</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">down</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next</span><span class="plain-syntax">, </span><span class="identifier-syntax">q</span><span class="plain-syntax">, </span><span class="identifier-syntax">m</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><a href="3-nlpr.html#SP3" class="function-link"><span class="function-syntax">LPRequests::initialise</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">glps</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-nlpr.html#SP4_2" class="named-paragraph-link"><span class="named-paragraph">Parse the object noun phrase of the specifies sentence</span><span class="named-paragraph-number">4.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-nlpr.html#SP4_1" class="named-paragraph-link"><span class="named-paragraph">Parse the subject noun phrase of the specifies sentence</span><span class="named-paragraph-number">4.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">LiteralPatterns::new_literal_specification_inner</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">glps</span><span class="plain-syntax">, </span><span class="identifier-syntax">p</span><span class="plain-syntax">, </span><span class="identifier-syntax">q</span><span class="plain-syntax">, </span><span class="identifier-syntax">m</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4_1" class="paragraph-anchor"></a><b>&#167;4.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Parse the subject noun phrase of the specifies sentence</span><span class="named-paragraph-number">4.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="function-syntax">&lt;specifies-sentence-subject&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">p</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">glps</span><span class="plain-syntax">.</span><span class="element-syntax">notation_wording</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;specifies-sentence-subject&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">glps</span><span class="plain-syntax">.</span><span class="element-syntax">notation_options</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;r&gt;&gt;</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">glps</span><span class="plain-syntax">.</span><span class="element-syntax">notation_groups</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;rp&gt;&gt;</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">glps</span><span class="plain-syntax">.</span><span class="element-syntax">notation_options</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">ABANDON_LPN</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">m</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nlpr.html#SP4">&#167;4</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>The following grammar is used to parse the new literal patterns defined
in a "specifies" sentence.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">PARTS_LPC</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">SCALING_LPC</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">OFFSET_LPC</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">EQUIVALENT_LPC</span><span class="plain-syntax"> </span><span class="constant-syntax">4</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b>Formally, the subject noun phrase of a "specifies" sentence must be a list
of alternatives each of which matches the following:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="function-syntax">&lt;specifies-sentence-subject&gt;</span>
<span class="plain-syntax">    ... ( {</span><span class="function-syntax">&lt;lp-group-list&gt;</span><span class="plain-syntax">} ) |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;k-kind-articled&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">times</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;k-kind-articled&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;s-type-expression&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">times</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;s-type-expression&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;k-kind-articled&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">minus</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;k-kind-articled&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;s-type-expression&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">minus</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;s-type-expression&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ...</span>

<span class="function-syntax">&lt;lp-group-list&gt;</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;lp-group&gt;</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;lp-group-tail&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;lp-group&gt;</span>

<span class="function-syntax">&lt;lp-group-tail&gt;</span>
<span class="plain-syntax">    , </span><span class="identifier-syntax">and</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;lp-group-list&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ,/</span><span class="identifier-syntax">and</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;lp-group-list&gt;</span>

<span class="function-syntax">&lt;lp-group&gt;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">singular</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">plural</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;lp-group-name&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">in</span><span class="plain-syntax"> ...... |</span>
<span class="plain-syntax">    ......</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6_1" class="paragraph-anchor"></a><b>&#167;6.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Store left and right kinds</span><span class="named-paragraph-number">6.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">Kinds::Dimensions::dim_set_multiplication</span><span class="plain-syntax">(</span><span class="identifier-syntax">RP</span><span class="plain-syntax">[1], </span><span class="identifier-syntax">RP</span><span class="plain-syntax">[2], </span><span class="identifier-syntax">glps</span><span class="plain-syntax">.</span><span class="element-syntax">kind_specified</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">ABANDON_LPN</span><span class="plain-syntax">, - };</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nlpr.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_2" class="paragraph-anchor"></a><b>&#167;6.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Subtract left and right kinds</span><span class="named-paragraph-number">6.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">Kinds::Dimensions::dim_set_subtraction</span><span class="plain-syntax">(</span><span class="identifier-syntax">RP</span><span class="plain-syntax">[1], </span><span class="identifier-syntax">RP</span><span class="plain-syntax">[2], </span><span class="identifier-syntax">glps</span><span class="plain-syntax">.</span><span class="element-syntax">kind_specified</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">ABANDON_LPN</span><span class="plain-syntax">, - };</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nlpr.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_3" class="paragraph-anchor"></a><b>&#167;6.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue PM_MultiplyingNonKOVs problem</span><span class="named-paragraph-number">6.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">preform_lookahead_mode</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_MultiplyingNonKOVs</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"only kinds of value can be multiplied or subtracted here"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"and only in a sentence like 'A length times a length specifies an area.'"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">ABANDON_LPN</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax"> }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nlpr.html#SP6">&#167;6</a> (twice).</li></ul>
<p class="commentary firstcommentary"><a id="SP6_4" class="paragraph-anchor"></a><b>&#167;6.4. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue PM_BadLPNameOption problem</span><span class="named-paragraph-number">6.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">preform_lookahead_mode</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Problems::quote_source</span><span class="plain-syntax">(1, </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Problems::quote_wording</span><span class="plain-syntax">(2, </span><span class="identifier-syntax">W</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::handmade_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_BadLPNameOption</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Problems::issue_problem_segment</span><span class="plain-syntax">(</span>
<span class="plain-syntax">            </span><span class="string-syntax">"In the specification %1, I was expecting that '%2' would be an optional "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"note about one of the notations: it should have been one of 'singular', "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"'plural' or 'in ...'."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Problems::issue_problem_end</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">ABANDON_LPN</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax"> }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nlpr.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP4_2" class="paragraph-anchor"></a><b>&#167;4.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Parse the object noun phrase of the specifies sentence</span><span class="named-paragraph-number">4.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">glps</span><span class="plain-syntax">.</span><span class="element-syntax">offset_value</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;specifies-sentence-object&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">q</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;&lt;r&gt;&gt;</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">PARTS_LPC:</span><span class="plain-syntax"> </span><span class="identifier-syntax">glps</span><span class="plain-syntax">.</span><span class="element-syntax">part_np_list</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;rp&gt;&gt;</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">SCALING_LPC:</span><span class="plain-syntax"> </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">glps</span><span class="plain-syntax">.</span><span class="element-syntax">kind_specified</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">m</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nlpr.html#SP4">&#167;4</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. </b>The object noun phrase of a "specifies" sentence is required to match
the following grammar. Note that the tails are mutually exclusive; you
can't set both scaling and an equivalent, for instance.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="function-syntax">&lt;specifies-sentence-object&gt;</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;kind-specified-with-base&gt;</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;lp-specification-tail&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;kind-specified-with-base&gt;</span>

<span class="function-syntax">&lt;kind-specified-with-base&gt;</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;k-kind-articled&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">in</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;number-base&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;k-kind-articled&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ...</span>

<span class="function-syntax">&lt;number-base&gt;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">binary</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">octal</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">decimal</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">hexadecimal</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">base</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;cardinal-number&gt;</span>

<span class="function-syntax">&lt;lp-specification-tail&gt;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">with</span><span class="plain-syntax"> </span><span class="identifier-syntax">parts</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;lp-part-list&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;scaling-instruction&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;scaling-instruction&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">offset</span><span class="plain-syntax"> </span><span class="identifier-syntax">by</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;s-literal&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">offset</span><span class="plain-syntax"> </span><span class="identifier-syntax">by</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;s-literal&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">equivalent</span><span class="plain-syntax"> </span><span class="identifier-syntax">to</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;s-literal&gt;</span>

<span class="function-syntax">&lt;scaling-instruction&gt;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">scaled</span><span class="plain-syntax"> </span><span class="identifier-syntax">up</span><span class="plain-syntax"> </span><span class="identifier-syntax">by</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;scaling-amount&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">scaled</span><span class="plain-syntax"> </span><span class="identifier-syntax">down</span><span class="plain-syntax"> </span><span class="identifier-syntax">by</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;scaling-amount&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">scaled</span><span class="plain-syntax"> </span><span class="identifier-syntax">at</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;scaling-amount&gt;</span>

<span class="function-syntax">&lt;scaling-amount&gt;</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;cardinal-number&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;s-literal-real-number&gt;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7_1" class="paragraph-anchor"></a><b>&#167;7.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Scaling together with offset</span><span class="named-paragraph-number">7.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">glps</span><span class="plain-syntax">.</span><span class="element-syntax">offset_value_as_double</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LiteralPatterns::get_latest_real</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">glps</span><span class="plain-syntax">.</span><span class="element-syntax">offset_value</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RP</span><span class="plain-syntax">[2];</span>
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">SCALING_LPC</span><span class="plain-syntax">, - };</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nlpr.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7_2" class="paragraph-anchor"></a><b>&#167;7.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Offset alone</span><span class="named-paragraph-number">7.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">glps</span><span class="plain-syntax">.</span><span class="element-syntax">offset_value_as_double</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LiteralPatterns::get_latest_real</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">glps</span><span class="plain-syntax">.</span><span class="element-syntax">offset_value</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RP</span><span class="plain-syntax">[1];</span>
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">OFFSET_LPC</span><span class="plain-syntax">, - };</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nlpr.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7_3" class="paragraph-anchor"></a><b>&#167;7.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Equivalency</span><span class="named-paragraph-number">7.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">glps</span><span class="plain-syntax">.</span><span class="element-syntax">equivalent_value_as_double</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LiteralPatterns::get_latest_real</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">glps</span><span class="plain-syntax">.</span><span class="element-syntax">equivalent_value</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RP</span><span class="plain-syntax">[1];</span>
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">EQUIVALENT_LPC</span><span class="plain-syntax">, - };</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nlpr.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7_4" class="paragraph-anchor"></a><b>&#167;7.4. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Accept an integer scale factor</span><span class="named-paragraph-number">7.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">glps</span><span class="plain-syntax">.</span><span class="element-syntax">scale_factor</span><span class="plain-syntax"> = </span><span class="identifier-syntax">R</span><span class="plain-syntax">[1];</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">glps</span><span class="plain-syntax">.</span><span class="element-syntax">scale_factor_as_double</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">double</span><span class="plain-syntax">) </span><span class="identifier-syntax">R</span><span class="plain-syntax">[1];</span>
<span class="plain-syntax">    ==&gt; { -, - };</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nlpr.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7_5" class="paragraph-anchor"></a><b>&#167;7.5. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Accept a real scale factor</span><span class="named-paragraph-number">7.5</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">glps</span><span class="plain-syntax">.</span><span class="element-syntax">scale_factor</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">glps</span><span class="plain-syntax">.</span><span class="element-syntax">scale_factor_as_double</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LiteralPatterns::get_latest_real</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">glps</span><span class="plain-syntax">.</span><span class="element-syntax">uses_real_arithmetic</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    ==&gt; { -, - };</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nlpr.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7_6" class="paragraph-anchor"></a><b>&#167;7.6. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue PM_LPNotKOV problem</span><span class="named-paragraph-number">7.6</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">preform_lookahead_mode</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_LPNotKOV</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"you can only specify ways to write kinds of value"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"as created with sentences like 'A weight is a kind of value.'"</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nlpr.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. </b>Of the optional tails, the only tricky one is the part list, which has the
following rather extensive grammar. This handles text like:
</p>

<blockquote>
    <p>dollars and cents (optional, preamble optional)</p>
</blockquote>

<p class="commentary">The text is a list of part-names, each of which can optionally be followed
by a bracketed list of up to three options in any order.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="function-syntax">&lt;lp-part-list&gt;</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;lp-part&gt;</span><span class="plain-syntax"> , </span><span class="identifier-syntax">and</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;lp-part-list&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;lp-part&gt;</span><span class="plain-syntax"> , </span><span class="function-syntax">&lt;lp-part-list&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;lp-part&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">and</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;lp-part-list&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;lp-part&gt;</span>

<span class="function-syntax">&lt;lp-part&gt;</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;np-unparsed-bal&gt;</span><span class="plain-syntax"> ( </span><span class="function-syntax">&lt;lp-part-option-list&gt;</span><span class="plain-syntax"> ) |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;np-unparsed-bal&gt;</span>

<span class="function-syntax">&lt;lp-part-option-list&gt;</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;lp-part-option&gt;</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;lp-part-option-tail&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;lp-part-option&gt;</span>

<span class="function-syntax">&lt;lp-part-option-tail&gt;</span>
<span class="plain-syntax">    , </span><span class="identifier-syntax">and</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;lp-part-option-list&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ,/</span><span class="identifier-syntax">and</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;lp-part-option-list&gt;</span>

<span class="function-syntax">&lt;lp-part-option&gt;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">optional</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">preamble</span><span class="plain-syntax"> </span><span class="identifier-syntax">optional</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">with</span><span class="plain-syntax"> </span><span class="identifier-syntax">leading</span><span class="plain-syntax"> </span><span class="identifier-syntax">zeros</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">without</span><span class="plain-syntax"> </span><span class="identifier-syntax">leading</span><span class="plain-syntax"> </span><span class="identifier-syntax">zeros</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">in</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;number-base&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;cardinal-number&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">to</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;cardinal-number&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">up</span><span class="plain-syntax"> </span><span class="identifier-syntax">to</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;cardinal-number&gt;</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;number-base&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">digit</span><span class="plain-syntax">/</span><span class="identifier-syntax">digits</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">up</span><span class="plain-syntax"> </span><span class="identifier-syntax">to</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;cardinal-number&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">digit</span><span class="plain-syntax">/</span><span class="identifier-syntax">digits</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;cardinal-number&gt;</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;number-base&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">digit</span><span class="plain-syntax">/</span><span class="identifier-syntax">digits</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;cardinal-number&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">digit</span><span class="plain-syntax">/</span><span class="identifier-syntax">digits</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">digits</span><span class="plain-syntax"> { </span><span class="function-syntax">&lt;quoted-text&gt;</span><span class="plain-syntax"> } |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">values</span><span class="plain-syntax"> { </span><span class="function-syntax">&lt;quoted-text&gt;</span><span class="plain-syntax"> } |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">corresponding</span><span class="plain-syntax"> </span><span class="identifier-syntax">to</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;k-kind&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">corresponding</span><span class="plain-syntax"> </span><span class="identifier-syntax">to</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;article&gt;</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;k-kind&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    ......</span>
</pre>
<p class="commentary firstcommentary"><a id="SP8_1" class="paragraph-anchor"></a><b>&#167;8.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Apply range</span><span class="named-paragraph-number">8.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">R</span><span class="plain-syntax">[1] &gt; </span><span class="identifier-syntax">R</span><span class="plain-syntax">[2])</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(...),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"the minimum value for a named part cannot be greater than the maximum"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"or it would be impossible for any value of this kind to exist."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">MINIMUM_LSO</span><span class="plain-syntax"> + </span><span class="constant-syntax">MAXIMUM_LSO</span><span class="plain-syntax">, - };</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nlpr.html#SP8">&#167;8</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8_2" class="paragraph-anchor"></a><b>&#167;8.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Apply max digit count</span><span class="named-paragraph-number">8.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">R</span><span class="plain-syntax">[1] &lt; </span><span class="constant-syntax">1</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(...),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"the digit count in a named part has to be at least 1"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"for obvious reasons."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">MAX_DIGITS_LSO</span><span class="plain-syntax">*</span><span class="identifier-syntax">R</span><span class="plain-syntax">[1], - }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nlpr.html#SP8">&#167;8</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8_3" class="paragraph-anchor"></a><b>&#167;8.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Apply digit count</span><span class="named-paragraph-number">8.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">R</span><span class="plain-syntax">[1] &lt; </span><span class="constant-syntax">1</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(...),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"the digit count in a named part has to be at least 1"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"for obvious reasons."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">MAX_DIGITS_LSO</span><span class="plain-syntax">*</span><span class="identifier-syntax">R</span><span class="plain-syntax">[1] + </span><span class="constant-syntax">MIN_DIGITS_LSO</span><span class="plain-syntax">*</span><span class="identifier-syntax">R</span><span class="plain-syntax">[1] + </span><span class="constant-syntax">WITH_LEADING_ZEROS_LSO</span><span class="plain-syntax">, - };</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nlpr.html#SP8">&#167;8</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8_4" class="paragraph-anchor"></a><b>&#167;8.4. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Apply based max digit count</span><span class="named-paragraph-number">8.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">R</span><span class="plain-syntax">[1] &lt; </span><span class="constant-syntax">1</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(...),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"the digit count in a named part has to be at least 1"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"for obvious reasons."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">MAX_DIGITS_LSO</span><span class="plain-syntax">*</span><span class="identifier-syntax">R</span><span class="plain-syntax">[1] + </span><span class="constant-syntax">BASE_LSO</span><span class="plain-syntax">*</span><span class="identifier-syntax">R</span><span class="plain-syntax">[2], - }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nlpr.html#SP8">&#167;8</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8_5" class="paragraph-anchor"></a><b>&#167;8.5. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Apply based digit count</span><span class="named-paragraph-number">8.5</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">R</span><span class="plain-syntax">[1] &lt; </span><span class="constant-syntax">1</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(...),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"the digit count in a named part has to be at least 1"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"for obvious reasons."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">MAX_DIGITS_LSO</span><span class="plain-syntax">*</span><span class="identifier-syntax">R</span><span class="plain-syntax">[1] + </span><span class="constant-syntax">MIN_DIGITS_LSO</span><span class="plain-syntax">*</span><span class="identifier-syntax">R</span><span class="plain-syntax">[1] + </span><span class="constant-syntax">BASE_LSO</span><span class="plain-syntax">*</span><span class="identifier-syntax">R</span><span class="plain-syntax">[2] + </span><span class="constant-syntax">WITH_LEADING_ZEROS_LSO</span><span class="plain-syntax">, - };</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nlpr.html#SP8">&#167;8</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8_6" class="paragraph-anchor"></a><b>&#167;8.6. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue PM_BadLPPartOption problem</span><span class="named-paragraph-number">8.6</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">preform_lookahead_mode</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Problems::quote_source</span><span class="plain-syntax">(1, </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Problems::quote_wording</span><span class="plain-syntax">(2, </span><span class="identifier-syntax">W</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::handmade_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_BadLPPartOption</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Problems::issue_problem_segment</span><span class="plain-syntax">(</span>
<span class="plain-syntax">            </span><span class="string-syntax">"In the specification %1, I was expecting that '%2' would be an optional "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"note about one of the parts: it should have been one of 'optional', "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"'preamble optional' or 'without leading zeros'."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Problems::issue_problem_end</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    ==&gt; { </span><span class="constant-syntax">0</span><span class="plain-syntax">, - };</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nlpr.html#SP8">&#167;8</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">literal_pattern_name</span><span class="plain-syntax"> *</span><span class="function-syntax">LPRequests::compose</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">LPRequests::compose</span></span>:<br/><a href="3-nlpr.html#SP6">&#167;6</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">literal_pattern_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="identifier-syntax">literal_pattern_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">B</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">A</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">B</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">A</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">next_with_rp</span><span class="plain-syntax"> = </span><span class="identifier-syntax">B</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">A</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. </b>Nodes used as "parts" of a notation are annotated with a bitmap of these:
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">OPTIONAL_LSO</span><span class="plain-syntax">                 </span><span class="constant-syntax">0x00000001</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">PREAMBLE_OPTIONAL_LSO</span><span class="plain-syntax">        </span><span class="constant-syntax">0x00000002</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">WITH_LEADING_ZEROS_LSO</span><span class="plain-syntax">       </span><span class="constant-syntax">0x00000004</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">WITHOUT_LEADING_ZEROS_LSO</span><span class="plain-syntax">    </span><span class="constant-syntax">0x00000008</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">MAXIMUM_LSO</span><span class="plain-syntax">                  </span><span class="constant-syntax">0x00000010</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">MINIMUM_LSO</span><span class="plain-syntax">                  </span><span class="constant-syntax">0x00000020</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">DIGITS_TEXT_LSO</span><span class="plain-syntax">              </span><span class="constant-syntax">0x00000040</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">VALUES_TEXT_LSO</span><span class="plain-syntax">              </span><span class="constant-syntax">0x00000080</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">KIND_LSO</span><span class="plain-syntax">                     </span><span class="constant-syntax">0x00000100</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">BASE_LSO</span><span class="plain-syntax">                     </span><span class="constant-syntax">0x00000200</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">BASE_MASK_LSO</span><span class="plain-syntax">                </span><span class="constant-syntax">0x0000fe00</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">MIN_DIGITS_LSO</span><span class="plain-syntax">               </span><span class="constant-syntax">0x00010000</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">MIN_DIGITS_MASK_LSO</span><span class="plain-syntax">          </span><span class="constant-syntax">0x007f0000</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">MAX_DIGITS_LSO</span><span class="plain-syntax">               </span><span class="constant-syntax">0x01000000</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">MAX_DIGITS_MASK_LSO</span><span class="plain-syntax">          </span><span class="constant-syntax">0x7f000000</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="function-syntax">LPRequests::mark</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">LPRequests::mark</span></span>:<br/><a href="3-nlpr.html#SP8">&#167;8</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">N</span><span class="plain-syntax">, </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">K</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">MI</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">MA</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">DT</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">VT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">A</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Annotations::write_int</span><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="identifier-syntax">lpe_options_ANNOT</span><span class="plain-syntax">, </span><span class="identifier-syntax">N</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">N</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">KIND_LSO</span><span class="plain-syntax">) </span><span class="identifier-syntax">Node::set_corresponding_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="identifier-syntax">K</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">N</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">MINIMUM_LSO</span><span class="plain-syntax">) </span><span class="identifier-syntax">Annotations::write_int</span><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="identifier-syntax">lpe_min_ANNOT</span><span class="plain-syntax">, </span><span class="identifier-syntax">MI</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">N</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">MAXIMUM_LSO</span><span class="plain-syntax">) </span><span class="identifier-syntax">Annotations::write_int</span><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="identifier-syntax">lpe_max_ANNOT</span><span class="plain-syntax">, </span><span class="identifier-syntax">MA</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">N</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">DIGITS_TEXT_LSO</span><span class="plain-syntax">) </span><span class="identifier-syntax">Annotations::write_int</span><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="identifier-syntax">lpe_digits_ANNOT</span><span class="plain-syntax">, </span><span class="identifier-syntax">DT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">N</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">VALUES_TEXT_LSO</span><span class="plain-syntax">) </span><span class="identifier-syntax">Annotations::write_int</span><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="identifier-syntax">lpe_values_ANNOT</span><span class="plain-syntax">, </span><span class="identifier-syntax">VT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">A</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="3-nar.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-am.html">1</a></li><li class="progresschapter"><a href="2-bv.html">2</a></li><li class="progresscurrentchapter">3</li><li class="progresssection"><a href="3-dlr.html">dlr</a></li><li class="progresssection"><a href="3-pr.html">pr</a></li><li class="progresssection"><a href="3-tr.html">tr</a></li><li class="progresssection"><a href="3-nuor.html">nuor</a></li><li class="progresssection"><a href="3-uor.html">uor</a></li><li class="progresssection"><a href="3-tr2.html">tr2</a></li><li class="progresssection"><a href="3-dbtr.html">dbtr</a></li><li class="progresssection"><a href="3-rpr.html">rpr</a></li><li class="progresssection"><a href="3-nar.html">nar</a></li><li class="progresscurrent">nlpr</li><li class="progresssection"><a href="3-nrr.html">nrr</a></li><li class="progresssection"><a href="3-npr.html">npr</a></li><li class="progresssection"><a href="3-nvr.html">nvr</a></li><li class="progresssection"><a href="3-nar2.html">nar2</a></li><li class="progresssection"><a href="3-ir.html">ir</a></li><li class="progresssection"><a href="3-ldr.html">ldr</a></li><li class="progresschapter"><a href="4-nr.html">4</a></li><li class="progresschapter"><a href="5-id.html">5</a></li><li class="progresschapter"><a href="6-rls.html">6</a></li><li class="progresschapter"><a href="7-tc.html">7</a></li><li class="progresschapter"><a href="8-kpr.html">8</a></li><li class="progressnext"><a href="3-nrr.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

